/**********************************************************************************
// Missile Source Code
// 
// Creation:	08 Mai 2011
// Updated:		08 Mai 2011
// Compiler:	Visual Studio 2010
//
// Notes:		Defines a missile for the game Space Race
//
**********************************************************************************/

#include "Missile.h"

/**********************************************************************************/

Missile::Missile(Ship * s) : Sprite("Resources/Missile.png")
{
	// set direction and speed of missile
	speed.SetVector(s->direction.Ang(), 20.0f);
	
	// get the position for the top of the ship
	// distance from center to top of the ship is 10 pixels
	float x = 16 * cos(s->direction.Rad());
	float y = -16 * sin(s->direction.Rad());

	// make the top of the ship the starting position for the missile
	MoveTo(s->x + x, s->y + y);
	customType = objMissile;

	// create bounding box for the missile
	boundingbox = new Point(s->x + x, s->y + y); 
	boundingbox->color = Color(255,255,0);
	boundingbox->customType = objMissile;
}

/**********************************************************************************/

Missile::~Missile()
{
	delete boundingbox;
}

/**********************************************************************************/

void Missile::Move()
{
	// Translate missile by its speed 
	Translate(speed.GetX(), -1.0f * speed.GetY());
}

/**********************************************************************************/
